package com.dems.web;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dems.dao.RepairDao;
import com.dems.domain.Student;

/**
 * Servlet implementation class OkRepairResultServlet
 */
@WebServlet("/RepairResultServlet")
public class RepairResultServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
    private RepairDao repairDao = new RepairDao();
    public RepairResultServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		int repairId = Integer.parseInt(request.getParameter("repairId"));
		String repairState = request.getParameter("repairState");
		if(repairState.equals("success")) {
			repairState="维修成功";
		}else {
			repairState="维修失败";
		}
		repairDao.repairResult(repairId,repairState);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
